<template>
  <AirQualityHeader/>
  <div class="main-container">
    <div class="top-row">
      <div class="left-panel">
        <AirQuality :area="selectedCity"/>
      </div>
      <div class="right-panel">
        <RegionSelect @citySelected="handleCitySelected"/>
      </div>
    </div>
    <div class="bottom-row">
      <AQITrend :area="selectedCity"/>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import AirQuality from './components/AirQuality.vue';
import AQITrend from './components/AQITrend.vue';
import RegionSelect from './components/RegionSelect.vue';
import AirQualityHeader from './components/AirQualityHeader.vue';

const selectedCity = ref('惠州市');

const handleCitySelected = (city) => {
  selectedCity.value = city;
}

</script>

<style>
/* 重置默认样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
  "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f0f2f5;
  color: #333;
  overflow: hidden;
}

/* 如果需要设置全局样式，可以在这里添加 */


/* 设置链接样式 */
a {
  text-decoration: none;
  color: #1890ff;
}

a:hover {
  outline: none;
  border: none;
  cursor: pointer;
}

button:hover {
  opacity: 0.9;
}

/* 添加新的布局样式 */
.main-container {
  height: calc(100vh - 75px); /* 减去AirQualityHeader组件的高度 */
  display: flex;
  flex-direction: column;
}

.top-row {
  display: flex;
  height: 100%;
  gap: 20px;
  flex: 2;
}

.left-panel {
  height: 100%;
  flex: 2;
}

.right-panel {
  flex: 1;
}

.bottom-row {
  /* margin-top: -200px; */
  width: 100%;
  flex: 1
}
</style>